package Waiting;

import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;

public class BackGround {
    //当前场景要显示的图片
    private BufferedImage bgImage = null;
    //记录当前是第几关
    private int sort;
    //判断是否是最后一个场景
    private int flag;



    //定义一个列表用于存放所有障碍物
    private List<Obstacle> obstacleList = new ArrayList<>();

    public BackGround(){ //空参构造
    }
    public BackGround (int sort,int flag){
        this.sort=sort;
        this.flag=flag;
        if(flag==2){ //最后一关
            bgImage = StaticValue.bg2;//调出最后一个场景bg2
        }if(flag==0) { //开始页面
            bgImage = StaticValue.bg1;
        }
        if (flag==1){ //第一关页面
            bgImage = StaticValue.bg3;
        }
        //判断是否是第一关
        if(sort == 1) {
            //绘制第一关的地面
            for (int i = 0;i<40;i++){
                obstacleList.add(new Obstacle(i*36,29,1,this));
            }
            //绘制蓝水
            for (int i = 1;i<1;i++){
                obstacleList.add(new Obstacle(i*657,1012,2,this));
            }
        }
    }

    public BufferedImage getBgImage() {
        return bgImage;
    }

    public int getSort() {
        return sort;
    }

    public int isFlag() {
        return flag;
    }
    public List<Obstacle> getObstacleList() {
        return obstacleList;
    }
}
